home *** CD-ROM | disk | FTP | other *** search
- program test;
- uses coun;
-
- type
- st1 = record
- int: integer;
- ch : array [1..2] of STRING;
- end;
- str = record
- st1 : string[8];
- st2 : String;
- Int : Integer;
- a1 : array [1..2] of byte;
- st3 : String[24];
- a2 : array [1..2] of st1;
- ab : array [1..5] of byte;
- end;
-
- const rmap : string = 's8s,4s24[2i[2s]]5'; {map of str record above}
- {s8 is st1}
- {s is st2}
- {the comma seporates the s from the 4 so as not to confuse
- it for a 4 byte string}
- {4 is both the Int and the a1 array each being 2 bytes}
- {s25 is st3}
- {[2 start a2}
- {b[2c] is st1}
- {the last ] closes off a2}
- {ab is 5 bytes}
-
- var struct : str;
- barray : array [1..100] of byte;
- x : Integer;
-
- begin
- struct.st1 := 'carl';
- struct.st2 := 'Franz';
- struct.int := 5;
- struct.a1[1] := 1;
- struct.a1[2] := 2;
- struct.st3 := 'String24';
- struct.a2[1].int:= 3;
- struct.a2[2].int:= 4;
- struct.a2[1].ch[1] := 'carl';
- struct.a2[1].ch[2] := 'Doug';
- struct.a2[2].ch[1] := 'Lynette';
- struct.a2[2].ch[2] := 'alex';
- Struct.ab[1] := 1; Struct.ab[2] := 2;
- Struct.ab[3] := 3; Struct.ab[4] := 4; Struct.ab[5] := 5;
-
- x := Compress(rmap,struct,barray);
-
- writeln('Before length is : ',sizeof(struct),' after length is:',x);
-
- struct.st1 := ' ';
- struct.st2 := ' ';
- struct.int := 0;
- struct.a1[1] := 0;
- struct.a1[2] := 0;
- struct.st3 := ' ';
- struct.a2[1].int:= 0;
- struct.a2[2].int:= 0;
- struct.a2[1].ch[1] := ' ';
- struct.a2[1].ch[2] := ' ';
- struct.a2[2].ch[1] := ' ';
- struct.a2[2].ch[2] := ' ';
- Struct.ab[1] := 0; Struct.ab[2] := 0;
- Struct.ab[3] := 3; Struct.ab[4] := 4; Struct.ab[5] := 5;
-
- UnCompress(rmap,barray,struct);
- end.
-